//package com.cqc.web;
//
//import org.springframework.boot.web.servlet.ServletComponentScan;
//import org.springframework.context.annotation.Configuration;
//
//import javax.servlet.*;
//import javax.servlet.annotation.WebFilter;
//import javax.servlet.http.HttpServlet;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//
///**
// * 如果继承HttpServlet，那么一定还要配置注解 @ServletComponentScan，
// */
//@Configuration
//@WebFilter(filterName = "MyCorsFilter", urlPatterns = "/*")
////public class MyCorsFilter implements Filter {
//@ServletComponentScan
//public class MyCorsFilter extends HttpServlet implements Filter {
//
//    @Override
//    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
//        HttpServletRequest request = (HttpServletRequest) servletRequest;
//        HttpServletResponse response = (HttpServletResponse) servletResponse;
//        response.setHeader("Access-Control-Allow-Origin", "*");
//        response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
//        response.setHeader("Access-Control-Max-Age", "3600");
//        response.setHeader("Access-Control-Allow-Headers", "Content-Type,x-requested-with,Authorization");
//        response.setHeader("Access-Control-Allow-Credentials", "true");
//        System.out.println("---------MyCorsFilter-----------" + request.getRequestURI());
//        filterChain.doFilter(servletRequest, servletResponse);
//    }
//
//}
